package com.tool.engine.export.mertics.collect;

import com.tool.engine.export.constant.CollectTypeEnum;

import java.util.List;

public class ExportCollect implements Collect {

    private final WindowCollect[] windowCollects = new WindowCollect[CollectTypeEnum.values().length];

    public ExportCollect() {
        for(CollectTypeEnum typeEnum : CollectTypeEnum.values()) {
            windowCollects[typeEnum.getType()] = new WindowCollect();
        }
    }

    @Override
    public void addValue(long value, int type,int size) {
        windowCollects[type].addValue(value, size);
    }

    @Override
    public void addValue(double value, int type, int size) {
        windowCollects[type].addValue(value, size);
    }

    @Override
    public List<NumberRecord> getAll(int type) {
        return windowCollects[type].getValues();
    }
}
